(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';

function isAndroid() {
	var userAgent = navigator.userAgent || navigator.vendor || window.opera;

	if (/android/i.test(userAgent)) {
		return true;
	}
	return false;
}

function fetchHotpointSummary() {
	var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};


	XT.jsonp({
		url: '/account/mywallet-info',
		data: { uid: XT.search.userId },
		super_success: function super_success(res) {
			// console.log('/account/account-by-id=====', res);
			options.callback && options.callback(res || []);
		}
	});
}

var store = new Vuex.Store({
	state: {
		showLoading: true,
		hotPointSummary: {}
	},
	actions: {
		getHotpointSummary: function getHotpointSummary(_ref) {
			var commit = _ref.commit,
			    state = _ref.state;
			var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

			console.log(333);
			commit('HIDE_LOADING');
			fetchHotpointSummary({
				callback: function callback(res) {
					commit('HIDE_LOADING');
					if (res.code == 'ok') {
						commit('HOT_POINT_SUMMARY', { hotPointSummary: res.data });
					}
				}
			});
		}
	},
	mutations: {
		HOT_POINT_SUMMARY: function HOT_POINT_SUMMARY(state) {
			var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

			console.log(payload);
			state.hotPointSummary = payload.hotPointSummary;
		},
		HIDE_LOADING: function HIDE_LOADING(state) {
			var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

			state.showLoading = false;
		}
	}
});

window.App = new Vue({
	el: '#App',
	store: store,
	data: {},
	methods: {
		openWx: function openWx() {
			var that = this;
			that.openWxDialog();
			XT.bridge.call('copyToClipboard', { content: encodeURIComponent('百媚直播服务号') }, function (res) {
				if (isAndroid()) {
					setTimeout(function () {
						that.openWxDialog();
					}, 2000);
				} else {
					that.openWxDialog();
				}
			});
		},
		openWxDialog: function openWxDialog() {
			MINT.MessageBox({
				title: '提示',
				message: '点击微信右上角+号,"添加朋友"粘贴并搜索,即可关注',
				showCancelButton: true,
				confirmButtonText: '前往微信',
				closeOnClickModal: true
			}).then(function (action) {
				if (action == 'confirm') {
					window.location.href = 'bmlive://bmlive/openWX';
				}
			});
		},
		callCustomerService: function callCustomerService() {
			window.location.href = 'bmlive://bmlive/callCustomerService';
		}
	},
	computed: {
		showLoading: function showLoading() {
			return this.$store.state.showLoading;
		},
		hotPointSummary: function hotPointSummary() {
			return this.$store.state.hotPointSummary;
		}
	},
	created: function created() {
		var that = this;
		XT.getUserInfo(function (info) {
			that.$store.dispatch('getHotpointSummary');
		});
	}
});

},{}]},{},[1]);
